From: Ralf Jung Date: Fri, 18 Aug 2017 18:10:34 +0000 (+0200) Subject: fix borrowing the shell twice X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~7^2~12^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=8a4a291dd7cc4f8f37d877a79be962ec029d9b53;p=cargo.git fix borrowing the shell twice --- diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index 2b751d6a8..4b633c26d 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -57,7 +57,7 @@ use url::Url; use core::{PackageId, Registry, SourceId, Summary, Dependency}; use core::PackageIdSpec; -use core::shell::Shell; +use util::config::Config; use util::Graph; use util::errors::{CargoResult, CargoError}; use util::profile; @@ -342,7 +342,7 @@ type Activations = HashMap>>; pub fn resolve(summaries: &[(Summary, Method)], replacements: &[(PackageIdSpec, Dependency)], registry: &mut Registry, - shell: Option<&mut Shell>) -> CargoResult { + config: Option<&Config>) -> CargoResult { let cx = Context { resolve_graph: RcList::new(), resolve_features: HashMap::new(), @@ -377,7 +377,8 @@ pub fn resolve(summaries: &[(Summary, Method)], trace!("resolved: {:?}", resolve); // If we have a shell, emit warnings about required deps used as feature. - if let Some(shell) = shell { + if let Some(config) = config { + let mut shell = config.shell(); let mut warnings = &cx.warnings; while let Some(ref head) = warnings.head { shell.warn(&head.0)?; diff --git a/src/cargo/ops/resolve.rs b/src/cargo/ops/resolve.rs index 074f79898..cd88738ca 100644 --- a/src/cargo/ops/resolve.rs +++ b/src/cargo/ops/resolve.rs @@ -257,17 +257,15 @@ pub fn resolve_with_previous<'a>(registry: &mut PackageRegistry, None => root_replace.to_vec(), }; - let mut shell; - let opt_shell = if warn { - shell = ws.config().shell(); - Some(&mut *shell) + let config = if warn { + Some(ws.config()) } else { None }; let mut resolved = resolver::resolve(&summaries, &replace, registry, - opt_shell)?; + config)?; resolved.register_used_patches(registry.patches()); if let Some(previous) = previous { resolved.merge_from(previous)?;